# encoding=utf-8
#!/usr/sbin
import json
class okTest():
    #类变量。外部类名直接调用即可
    pass_list = []
    fail_list = []
    def oktest(self,index,exp_str,rel_str):
        #将传入的str 转成列表后再转集合，使用集合的交叉集进行判断
        exp_str = set(list(exp_str))
        rel_str = set(list(rel_str))
        if exp_str <=rel_str:
            okTest.pass_list.append(index)
            return 'pass'
        else:
            okTest.fail_list.append(index)
            return 'failed'
if __name__=="__main__":
    #测试
    test1 = '{"name": "test", "enable": true, "description": "create test", "schedule": "test", "srcZones": ["L3_manage"], "srcIpGroups": ["test01"], "dstIpGroups": ["test01"], "dstIsp": [], "dstCountryArea": [], "services": ["any"], "pbrType": "SRCADDRESS", "outif": [{"outifName": "eth0", "gateway": "10.5.36.254"}]}'
    test2 ='{"uuid": "EF301CC8B5AA47D08B2FA25191398FD9", "name": "test", "enable": true, "description": "create test", "schedule": "test", "srcZones": ["L3_manage"], "srcIpGroups": ["test01"], "dstIpGroups": ["test01"], "dstIsp": [], "dstCountryArea": [], "services": ["any"], "pbrType": "SRCADDRESS", "outif": [{"outifName": "eth0", "gateway": "10.5.36.254"}]}'
    test1 = set(list(test1))
    test2 = set(list(test2))
    res = okTest().oktest(1,test1,test2)
    print(res)